#coding:utf-8  
import os
import sys  
print '本脚本将指定文件夹下文件按指定前缀+升序命名'
print '注意指定文件夹的路径一定要以 / 结尾'
if len(sys.argv) < 3:
  print 'Usage: python rename.py 重命名文件所在文件夹 新文件名的前缀'
  exit()
path = sys.argv[1]
prefix = sys.argv[2]

dirs = os.listdir(path)  
i = 1
for file in dirs:  
    oldname = path + file
    newname = path + prefix + "%01d"%i +".asc"  
    os.rename(oldname,newname)
    i = i + 1 

print 'Finish!'
